/**
 */
package ConnectorGenerator.ElementArchitecture.impl;

import ConnectorGenerator.ElementArchitecture.ElementArchitecturePackage;
import ConnectorGenerator.ElementArchitecture.FeatureMapping;
import ConnectorGenerator.ElementArchitecture.SubElement;

import ConnectorGenerator.Feature.impl.FeatureValueImpl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Feature Mapping</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.FeatureMappingImpl#getSubElement <em>Sub Element</em>}</li>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.FeatureMappingImpl#getFeatureName <em>Feature Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FeatureMappingImpl extends FeatureValueImpl implements FeatureMapping {
	/**
	 * The cached value of the '{@link #getSubElement() <em>Sub Element</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSubElement()
	 * @generated
	 * @ordered
	 */
	protected SubElement subElement;

	/**
	 * The default value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFeatureName()
	 * @generated
	 * @ordered
	 */
	protected static final String FEATURE_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFeatureName()
	 * @generated
	 * @ordered
	 */
	protected String featureName = FEATURE_NAME_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureMappingImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ElementArchitecturePackage.Literals.FEATURE_MAPPING;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement getSubElement() {
		if (subElement != null && subElement.eIsProxy()) {
			InternalEObject oldSubElement = (InternalEObject)subElement;
			subElement = (SubElement)eResolveProxy(oldSubElement);
			if (subElement != oldSubElement) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT, oldSubElement, subElement));
			}
		}
		return subElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement basicGetSubElement() {
		return subElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSubElement(SubElement newSubElement) {
		SubElement oldSubElement = subElement;
		subElement = newSubElement;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT, oldSubElement, subElement));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getFeatureName() {
		return featureName;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFeatureName(String newFeatureName) {
		String oldFeatureName = featureName;
		featureName = newFeatureName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.FEATURE_MAPPING__FEATURE_NAME, oldFeatureName, featureName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT:
				if (resolve) return getSubElement();
				return basicGetSubElement();
			case ElementArchitecturePackage.FEATURE_MAPPING__FEATURE_NAME:
				return getFeatureName();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT:
				setSubElement((SubElement)newValue);
				return;
			case ElementArchitecturePackage.FEATURE_MAPPING__FEATURE_NAME:
				setFeatureName((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT:
				setSubElement((SubElement)null);
				return;
			case ElementArchitecturePackage.FEATURE_MAPPING__FEATURE_NAME:
				setFeatureName(FEATURE_NAME_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.FEATURE_MAPPING__SUB_ELEMENT:
				return subElement != null;
			case ElementArchitecturePackage.FEATURE_MAPPING__FEATURE_NAME:
				return FEATURE_NAME_EDEFAULT == null ? featureName != null : !FEATURE_NAME_EDEFAULT.equals(featureName);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (featureName: ");
		result.append(featureName);
		result.append(')');
		return result.toString();
	}

} //FeatureMappingImpl
